<!DOCTYPE html>
<html style="min-width: inherit">
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <title>物资云-迷你登录</title>
    <meta name="description" content="物资云">
    <meta name="Keywords" content="物资云">
    <link rel="icon" type="image/x-icon" href="./favicon.ico"/>
    <link rel="shortcut icon" type="image/x-icon" href="./favicon.ico"/>
    <link rel="stylesheet" href="static/css/common.css"/>
    <link rel="stylesheet" href="static/css/style.css"/>
</head>
<body  style="min-width: inherit">
<!--迷你登录块-->
<div class="MiniLog">
        <div class="MiniLogTil">
            <button id="tabBtn1" class="act">账号登录</button>
            <button id="tabBtn2">动态登录</button>
            <span class="cols" onclick="parent.miniClose()"></span>
        </div>
        <!--账号登录-->
        <div class="miniloginForm">
            <form id="form">
                <div class="errorPlacement"></div>
                <div class="inpPar mt-50">
                    <i class="iconText"></i><input name="mobile" type="text" placeholder="请输入您的手机号码"/>
                </div>
                <div class="inpPar mt-15">
                    <i class="iconPas"></i><input name="paw" type="password" placeholder="请输入密码"/>
                </div>
                <div class="clearfix mt-20">
                    <label class="pos-r fz14 col999">
                        <i class="checkStyle"></i>
                        <input class="checkStyleIpt" checked name="auto" type="checkbox"/>下次自动登录
                    </label>
                </div>
                <div class="t-c">
                    <button type="submit" class="logSbm mt-30">登&nbsp;&nbsp;录</button>
                </div>
            </form>
        </div>
        <!--验证登录    -->
        <div class="miniloginForm dis-n">
            <form id="form2">
                <div class="miniloginTip">* 验证即登录，未注册将自动创建账号</div>
                <div class="errorPlacement"></div>
                <div class="inpPar mt-50">
                    <i class="iconText"></i><input name="mobile2" type="text" placeholder="请输入您的手机号码"/>
                </div>
                <div class="inpPar mt-15 phoneCode">
                    <i class="iconPas"></i><input name="paw" type="password" placeholder="请输入密码"/>
                    <button class="btn-phoneCode" type="button" onclick="getCode(this,'mobile2','1')">获取验证码</button>
                </div>
                <div class="clearfix mt-20">
                    <label class="pos-r fz14 col999">
                        <i class="checkStyle"></i>
                        <input class="checkStyleIpt" checked name="auto" type="checkbox"/>下次自动登录
                    </label>
                </div>
                <div class="t-c">
                    <button type="submit" class="logSbm mt-30">登&nbsp;&nbsp;录</button>
                </div>
            </form>
        </div>
        <div class="r mr-10 mt-25 col666">
            还没有账号? <a href="./register.html" target="_blank" class="col448">立即注册</a>
        </div>
    <!--</div>-->
</div>
<script type="text/javascript" src="static/js/jquery.min.js"></script>
<script type="text/javascript" src="./static/plugins/jquery.validation/1.14.0/jquery.validate.min.js"></script>
<script type="text/javascript" src="./static/plugins/jquery.validation/1.14.0/validate-methods.js"></script>
<script type="text/javascript" src="static/js/common.js"></script>
<script type="text/javascript" >
    $(function(){
        //账号登录
        $("#form").validate({
            rules:{
                mobile:{
                    required:true,
                    isMobile:true
                },
                paw:{
                    required:true,
                }
            },
            messages:{
                mobile:{
                    required:"请输入正确格式手机号"
                },
                paw:{
                    required:"请输入密码"
                }
            },
            onkeyup:false,
            focusInvalid:false,
            focusCleanup:true,
            errorPlacement: function(error, element) {
                error.appendTo( $(element).parents('form').children('.errorPlacement') );
            },
            submitHandler:function(form){
                //                测试模拟成功后：
//                parent.MainObj.publicCallback()
                parent.MainObj.uniqueCallback()
                parent.miniClose()
                var param = $("#form").serialize();
                $.ajax({
                    type:"POST",
                    url:"/register",
                    data:param,
                    dataType:"json",
                    success:function(result){
//                    if(result.code==2000){

//                      成功后：
//                      parent.MainObj.publicCallback(result)
                        parent.MainObj.uniqueCallback(result)
                        parent.miniClose()


//                    }else if(result.code==2012){
//                        errorTis('user_code',result.msg)
//                    }else if(result.code==2004){
//                        errorTis('user_code','验证玛已过期')
//                    }else if(result.code==2005){
//                        errorTis('user_code','验证码有误或已使用')
//                    }else if(result.code==1001){
//                        errorTis('user_code',result.msg)
//                        changeImageCode();
//                    }else{
//                        layer.msg(result.msg,{icon:2,time:2000});
//                    }
                    }
                });
            }

        });
         //验证码登录
        $("#form2").validate({
            rules:{
                mobile2:{
                    required:true,
                    isMobile:true
                },
                paw:{
                    required:true,
                }
            },
            messages:{
                mobile2:{
                    required:"请输入正确格式手机号"
                },
                paw:{
                    required:"请输入密码"
                }
            },
            onkeyup:false,
            focusInvalid:false,
            focusCleanup:true,
            errorPlacement: function(error, element) {
                error.appendTo( $(element).parents('form').children('.errorPlacement') );
            },
            submitHandler:function(form){
//                测试模拟成功后：
//                parent.MainObj.publicCallback()
                parent.MainObj.uniqueCallback()
                parent.miniClose()
                var param = $("#form2").serialize();
                $.ajax({
                    type:"POST",
                    url:"/register",
                    data:param,
                    dataType:"json",
                    success:function(result){
//                    if(result.code==2000){

//                      成功后：
//                      parent.MainObj.publicCallback(result)
                        parent.MainObj.uniqueCallback(result)
                        parent.miniClose()

                    }
                });
            }

        });


//        切换
        $('.MiniLogTil button').on('click',function(){
            if($(this).hasClass('act')){return;}
            var ind = $(this).index();
            console.log(ind);
            $(this).addClass('act').siblings('button').removeClass('act')
            $('.miniloginForm').eq(ind).show().siblings('.miniloginForm').hide()
        })
    })
</script>

</body>
</html>